
$("#mainContent").hide();

// 引入swiper模块


var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
     	onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit
	    swiperAnimateCache(swiper); //隐藏动画元素 
	    swiperAnimate(swiper); //初始化完成开始动画
	  	},
	  	onSlideChangeEnd: function(swiper){ 
	    swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画
	  	} 
    });
    
    
    
    
$('#enter').click(function(){
  $(".swiper-container").hide();
  $("#mainContent").show();
  $.ajax({
	type:"get",
	url:"./mock/skill.json",
	dataType:'json',
	success:function(data){
		
		for(var i = 0 , len = data.length; i < len ; i ++){
			$('#liCollapse').clone(true).find('#spanI').html(data[i].category)
			.end().find('#spanD').html(data[i].name).end().find('#span1').html(data[i].category).end().find('#span2').html(data[i].level).end().find('#span3').html(data[i].time).end().find('#span4').html(data[i].name).end().show().appendTo('#press')
		}
		
	}
});

$.ajax({
	type:"get",
	url:"./mock/project.json",
	dataType:'json',
	success:function(data){
		console.log(data);
		for(var i = 0 , len = data.length; i < len ; i ++){
			$('#poll').clone(true).find('#poll1').css('background','url('+data[i].image+')')
			.end().find('#poll2').html(data[i].category).end()
			.find('#poll3').html(data[i].name).end().find('#poll4')
			.html(data[i].detail).end().find('#poll5').html(data[i].tech)
			.end().find('#poll6').html(data[i].description).end().find('#poll7')
			.html(data[i].url).end().show().appendTo('#pullsex')
		}
	}
});

})

 
$('.musi1').click(function(){
	var audioPlayer = document.querySelector('audio');
	
	if (audioPlayer.paused) {
		audioPlayer.play();
		$('.musi').attr('class','musi1 musi')
	}else{
		
		audioPlayer.pause();
		$('.musi').attr('class','musi1')
		
	}
});


//mui 页面 


//document.addEventListener( "plusready", onPlusReady, false );
// 扩展API加载完毕，现在可以正常调用扩展API 


// 拍照
function captureImage(){
	var cmr = plus.camera.getCamera();
	var res = cmr.supportedImageResolutions[0];
	var fmt = cmr.supportedImageFormats[0];
	console.log("Resolution: "+res+", Format: "+fmt);
	cmr.captureImage( function( path ){
			alert( "Capture image success: " + path );  
		},
		function( error ) {
			alert( "Capture image failed: " + error.message );
		},
		{resolution:res,format:fmt}
	);
}




//二维码


document.addEventListener( "plusready", onPlusReady, false );
//// 扩展API加载完毕，现在可以正常调用扩展API
function onPlusReady() {
	var e = document.getElementById("scan");
	e.removeAttribute( "disabled" );
}

var scan = null;
function onmarked( type, result ) {
	var text = '未知: ';
	switch(type){
		case plus.barcode.QR:
		text = 'QR: ';
		break;
		case plus.barcode.EAN13:
		text = 'EAN13: ';
		break;
		case plus.barcode.EAN8:
		text = 'EAN8: ';
		break;
	}
	alert( text+result );
}

function erweima(){
	
	scan = new plus.barcode.Barcode('bcid');
	scan.onmarked = onmarked; 
	
	scan.start();
}

function cancelScan() {
	scan.close();
}

$('#a2').click(function(){
	$('#tuiChu').show()
})
  



$('#tuiChu').click(function(){
	cancelScan();
	$('#tuiChu').hide()
})

